import { getCode, deleteCode } from "@/lib/code-cache";

export default function verifyCode(email, code) {
  if (!email || !code) { return { message: '邮箱和验证码不能为空', status: false }; }
  const savedCode = getCode(email);
  if (!savedCode) { return { message: '验证码已过期', status: false }; }
  if (savedCode !== code) { return { message: '验证码错误', status: false }; }
  deleteCode(email);
  return { status: true };
}
